package events
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	/**
	 * ...
	 * @author Gareth Williams
	 */
	public class EventBus
	{
		private static var _dispatcher:EventDispatcher = null;
		private static function get dispatcher():EventDispatcher
		{
			if (_dispatcher === null) _dispatcher = new EventDispatcher();
			return _dispatcher;
		}
		//wrap interface
		public static function dispatchEvent(event:Event):Boolean 
		{
			//trace(event, "dispatched on bus");
			return dispatcher.dispatchEvent(event);
		}
		public static function removeEventListener(type:String, listener:Function):void 
		{
			dispatcher.removeEventListener(type, listener, false);
		}
		public static function addEventListener(type:String, listener:Function):void 
		{
			dispatcher.addEventListener(type, listener, false, 0, true);
		}
	}
}